home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / lang / Class.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  21.6 KB  |  1,151 lines

  1. package java.lang;
  2.  
  3. import [Ljava.lang.Object;;
  4. import java.io.InputStream;
  5. import java.io.ObjectStreamField;
  6. import java.io.Serializable;
  7. import java.lang.annotation.Annotation;
  8. import java.lang.ref.SoftReference;
  9. import java.lang.reflect.AnnotatedElement;
  10. import java.lang.reflect.Array;
  11. import java.lang.reflect.Constructor;
  12. import java.lang.reflect.Field;
  13. import java.lang.reflect.GenericArrayType;
  14. import java.lang.reflect.GenericDeclaration;
  15. import java.lang.reflect.InvocationTargetException;
  16. import java.lang.reflect.Method;
  17. import java.lang.reflect.Modifier;
  18. import java.lang.reflect.Type;
  19. import java.lang.reflect.TypeVariable;
  20. import java.net.URL;
  21. import java.security.AccessController;
  22. import java.security.CodeSource;
  23. import java.security.Permissions;
  24. import java.security.ProtectionDomain;
  25. import java.util.ArrayList;
  26. import java.util.Collection;
  27. import java.util.HashMap;
  28. import java.util.HashSet;
  29. import java.util.Map;
  30. import java.util.Set;
  31. import sun.misc.Unsafe;
  32. import sun.reflect.ConstantPool;
  33. import sun.reflect.Reflection;
  34. import sun.reflect.ReflectionFactory;
  35. import sun.reflect.annotation.AnnotationParser;
  36. import sun.reflect.annotation.AnnotationType;
  37. import sun.reflect.generics.factory.CoreReflectionFactory;
  38. import sun.reflect.generics.factory.GenericsFactory;
  39. import sun.reflect.generics.repository.ClassRepository;
  40. import sun.reflect.generics.repository.ConstructorRepository;
  41. import sun.reflect.generics.repository.MethodRepository;
  42. import sun.reflect.generics.scope.ClassScope;
  43. import sun.security.util.SecurityConstants;
  44.  
  45. public final class Class<T> implements Serializable, GenericDeclaration, Type, AnnotatedElement {
  46.    private static final int ANNOTATION = 8192;
  47.    private static final int ENUM = 16384;
  48.    private static final int SYNTHETIC = 4096;
  49.    private transient volatile Constructor<T> cachedConstructor;
  50.    private transient volatile Class newInstanceCallerCache;
  51.    private transient String name;
  52.    private static ProtectionDomain allPermDomain;
  53.    private static boolean useCaches;
  54.    private transient volatile SoftReference declaredFields;
  55.    private transient volatile SoftReference publicFields;
  56.    private transient volatile SoftReference declaredMethods;
  57.    private transient volatile SoftReference publicMethods;
  58.    private transient volatile SoftReference declaredConstructors;
  59.    private transient volatile SoftReference publicConstructors;
  60.    private transient volatile SoftReference declaredPublicFields;
  61.    private transient volatile SoftReference declaredPublicMethods;
  62.    private transient volatile int classRedefinedCount = 0;
  63.    private transient volatile int lastRedefinedCount = 0;
  64.    private transient ClassRepository genericInfo;
  65.    private static final long serialVersionUID = 3206093459760846163L;
  66.    private static final ObjectStreamField[] serialPersistentFields;
  67.    private static ReflectionFactory reflectionFactory;
  68.    private static boolean initted;
  69.    private transient volatile T[] enumConstants = null;
  70.    private transient volatile Map<String, T> enumConstantDirectory = null;
  71.    private static Annotation[] EMPTY_ANNOTATIONS_ARRAY;
  72.    private transient Map<Class, Annotation> annotations;
  73.    private transient Map<Class, Annotation> declaredAnnotations;
  74.    private AnnotationType annotationType;
  75.  
  76.    private static native void registerNatives();
  77.  
  78.    private Class() {
  79.    }
  80.  
  81.    public String toString() {
  82.       return (this.isInterface() ? "interface " : (this.isPrimitive() ? "" : "class ")) + this.getName();
  83.    }
  84.  
  85.    public static Class<?> forName(String var0) throws ClassNotFoundException {
  86.       return forName0(var0, true, ClassLoader.getCallerClassLoader());
  87.    }
  88.  
  89.    public static Class<?> forName(String var0, boolean var1, ClassLoader var2) throws ClassNotFoundException {
  90.       if (var2 == null) {
  91.          SecurityManager var3 = System.getSecurityManager();
  92.          if (var3 != null) {
  93.             ClassLoader var4 = ClassLoader.getCallerClassLoader();
  94.             if (var4 != null) {
  95.                var3.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
  96.             }
  97.          }
  98.       }
  99.  
  100.       return forName0(var0, var1, var2);
  101.    }
  102.  
  103.    private static native Class forName0(String var0, boolean var1, ClassLoader var2) throws ClassNotFoundException;
  104.  
  105.    public T newInstance() throws InstantiationException, IllegalAccessException {
  106.       if (System.getSecurityManager() != null) {
  107.          this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  108.       }
  109.  
  110.       return (T)this.newInstance0();
  111.    }
  112.  
  113.    private T newInstance0() throws InstantiationException, IllegalAccessException {
  114.       if (this.cachedConstructor == null) {
  115.          if (this == Class.class) {
  116.             throw new IllegalAccessException("Can not call newInstance() on the Class for java.lang.Class");
  117.          }
  118.  
  119.          try {
  120.             Class[] var1 = new Class[0];
  121.             Constructor var2 = this.getConstructor0(var1, 1);
  122.             AccessController.doPrivileged(new 1(this, var2));
  123.             this.cachedConstructor = var2;
  124.          } catch (NoSuchMethodException var5) {
  125.             throw new InstantiationException(this.getName());
  126.          }
  127.       }
  128.  
  129.       Constructor var6 = this.cachedConstructor;
  130.       int var7 = var6.getModifiers();
  131.       if (!Reflection.quickCheckMemberAccess(this, var7)) {
  132.          Class var3 = Reflection.getCallerClass(3);
  133.          if (this.newInstanceCallerCache != var3) {
  134.             Reflection.ensureMemberAccess(var3, this, (Object)null, var7);
  135.             this.newInstanceCallerCache = var3;
  136.          }
  137.       }
  138.  
  139.       try {
  140.          return (T)var6.newInstance((Object[])null);
  141.       } catch (InvocationTargetException var4) {
  142.          Unsafe.getUnsafe().throwException(var4.getTargetException());
  143.          return null;
  144.       }
  145.    }
  146.  
  147.    public native boolean isInstance(Object var1);
  148.  
  149.    public native boolean isAssignableFrom(Class<?> var1);
  150.  
  151.    public native boolean isInterface();
  152.  
  153.    public native boolean isArray();
  154.  
  155.    public native boolean isPrimitive();
  156.  
  157.    public boolean isAnnotation() {
  158.       return (this.getModifiers() & 8192) != 0;
  159.    }
  160.  
  161.    public boolean isSynthetic() {
  162.       return (this.getModifiers() & 4096) != 0;
  163.    }
  164.  
  165.    public String getName() {
  166.       if (this.name == null) {
  167.          this.name = this.getName0();
  168.       }
  169.  
  170.       return this.name;
  171.    }
  172.  
  173.    private native String getName0();
  174.  
  175.    public ClassLoader getClassLoader() {
  176.       ClassLoader var1 = this.getClassLoader0();
  177.       if (var1 == null) {
  178.          return null;
  179.       } else {
  180.          SecurityManager var2 = System.getSecurityManager();
  181.          if (var2 != null) {
  182.             ClassLoader var3 = ClassLoader.getCallerClassLoader();
  183.             if (var3 != null && var3 != var1 && !var1.isAncestor(var3)) {
  184.                var2.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
  185.             }
  186.          }
  187.  
  188.          return var1;
  189.       }
  190.    }
  191.  
  192.    native ClassLoader getClassLoader0();
  193.  
  194.    public TypeVariable<Class<T>>[] getTypeParameters() {
  195.       return this.getGenericSignature() != null ? (TypeVariable[])this.getGenericInfo().getTypeParameters() : (TypeVariable[])(new TypeVariable[0]);
  196.    }
  197.  
  198.    public native Class<? super T> getSuperclass();
  199.  
  200.    public Type getGenericSuperclass() {
  201.       if (this.getGenericSignature() != null) {
  202.          return this.isInterface() ? null : this.getGenericInfo().getSuperclass();
  203.       } else {
  204.          return this.getSuperclass();
  205.       }
  206.    }
  207.  
  208.    public Package getPackage() {
  209.       return Package.getPackage(this);
  210.    }
  211.  
  212.    public native Class<?>[] getInterfaces();
  213.  
  214.    public Type[] getGenericInterfaces() {
  215.       return (Type[])(this.getGenericSignature() != null ? this.getGenericInfo().getSuperInterfaces() : this.getInterfaces());
  216.    }
  217.  
  218.    public native Class<?> getComponentType();
  219.  
  220.    public native int getModifiers();
  221.  
  222.    public native Object[] getSigners();
  223.  
  224.    native void setSigners(Object[] var1);
  225.  
  226.    public Method getEnclosingMethod() {
  227.       EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
  228.       if (var1 == null) {
  229.          return null;
  230.       } else if (!var1.isMethod()) {
  231.          return null;
  232.       } else {
  233.          MethodRepository var2 = MethodRepository.make(var1.getDescriptor(), this.getFactory());
  234.          Class var3 = toClass(var2.getReturnType());
  235.          Type[] var4 = var2.getParameterTypes();
  236.          Class[] var5 = new Class[var4.length];
  237.  
  238.          for(int var6 = 0; var6 < var5.length; ++var6) {
  239.             var5[var6] = toClass(var4[var6]);
  240.          }
  241.  
  242.          for(Method var9 : var1.getEnclosingClass().getDeclaredMethods()) {
  243.             if (var9.getName().equals(var1.getName())) {
  244.                Class[] var10 = var9.getParameterTypes();
  245.                if (var10.length == var5.length) {
  246.                   boolean var11 = true;
  247.  
  248.                   for(int var12 = 0; var12 < var10.length; ++var12) {
  249.                      if (!var10[var12].equals(var5[var12])) {
  250.                         var11 = false;
  251.                         break;
  252.                      }
  253.                   }
  254.  
  255.                   if (var11 && var9.getReturnType().equals(var3)) {
  256.                      return var9;
  257.                   }
  258.                }
  259.             }
  260.          }
  261.  
  262.          throw new InternalError("Enclosing method not found");
  263.       }
  264.    }
  265.  
  266.    private native Object[] getEnclosingMethod0();
  267.  
  268.    private EnclosingMethodInfo getEnclosingMethodInfo() {
  269.       Object[] var1 = this.getEnclosingMethod0();
  270.       return var1 == null ? null : new EnclosingMethodInfo(var1, (1)null);
  271.    }
  272.  
  273.    private static Class toClass(Type var0) {
  274.       return var0 instanceof GenericArrayType ? Array.newInstance(toClass(((GenericArrayType)var0).getGenericComponentType()), 0).getClass() : (Class)var0;
  275.    }
  276.  
  277.    public Constructor<?> getEnclosingConstructor() {
  278.       EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
  279.       if (var1 == null) {
  280.          return null;
  281.       } else if (!var1.isConstructor()) {
  282.          return null;
  283.       } else {
  284.          ConstructorRepository var2 = ConstructorRepository.make(var1.getDescriptor(), this.getFactory());
  285.          Type[] var3 = var2.getParameterTypes();
  286.          Class[] var4 = new Class[var3.length];
  287.  
  288.          for(int var5 = 0; var5 < var4.length; ++var5) {
  289.             var4[var5] = toClass(var3[var5]);
  290.          }
  291.  
  292.          for(Constructor var8 : var1.getEnclosingClass().getDeclaredConstructors()) {
  293.             Class[] var9 = var8.getParameterTypes();
  294.             if (var9.length == var4.length) {
  295.                boolean var10 = true;
  296.  
  297.                for(int var11 = 0; var11 < var9.length; ++var11) {
  298.                   if (!var9[var11].equals(var4[var11])) {
  299.                      var10 = false;
  300.                      break;
  301.                   }
  302.                }
  303.  
  304.                if (var10) {
  305.                   return var8;
  306.                }
  307.             }
  308.          }
  309.  
  310.          throw new InternalError("Enclosing constructor not found");
  311.       }
  312.    }
  313.  
  314.    public native Class<?> getDeclaringClass();
  315.  
  316.    public Class<?> getEnclosingClass() {
  317.       EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
  318.       if (var1 == null) {
  319.          return this.getDeclaringClass();
  320.       } else {
  321.          Class var2 = var1.getEnclosingClass();
  322.          if (var2 != this && var2 != null) {
  323.             return var2;
  324.          } else {
  325.             throw new InternalError("Malformed enclosing method information");
  326.          }
  327.       }
  328.    }
  329.  
  330.    public String getSimpleName() {
  331.       if (this.isArray()) {
  332.          return this.getComponentType().getSimpleName() + "[]";
  333.       } else {
  334.          String var1 = this.getSimpleBinaryName();
  335.          if (var1 == null) {
  336.             var1 = this.getName();
  337.             return var1.substring(var1.lastIndexOf(".") + 1);
  338.          } else {
  339.             int var2 = var1.length();
  340.             if (var2 >= 1 && var1.charAt(0) == '$') {
  341.                int var3;
  342.                for(var3 = 1; var3 < var2 && isAsciiDigit(var1.charAt(var3)); ++var3) {
  343.                }
  344.  
  345.                return var1.substring(var3);
  346.             } else {
  347.                throw new InternalError("Malformed class name");
  348.             }
  349.          }
  350.       }
  351.    }
  352.  
  353.    private static boolean isAsciiDigit(char var0) {
  354.       return '0' <= var0 && var0 <= '9';
  355.    }
  356.  
  357.    public String getCanonicalName() {
  358.       if (this.isArray()) {
  359.          String var3 = this.getComponentType().getCanonicalName();
  360.          return var3 != null ? var3 + "[]" : null;
  361.       } else if (this.isLocalOrAnonymousClass()) {
  362.          return null;
  363.       } else {
  364.          Class var1 = this.getEnclosingClass();
  365.          if (var1 == null) {
  366.             return this.getName();
  367.          } else {
  368.             String var2 = var1.getCanonicalName();
  369.             return var2 == null ? null : var2 + "." + this.getSimpleName();
  370.          }
  371.       }
  372.    }
  373.  
  374.    public boolean isAnonymousClass() {
  375.       return "".equals(this.getSimpleName());
  376.    }
  377.  
  378.    public boolean isLocalClass() {
  379.       return this.isLocalOrAnonymousClass() && !this.isAnonymousClass();
  380.    }
  381.  
  382.    public boolean isMemberClass() {
  383.       return this.getSimpleBinaryName() != null && !this.isLocalOrAnonymousClass();
  384.    }
  385.  
  386.    private String getSimpleBinaryName() {
  387.       Class var1 = this.getEnclosingClass();
  388.       if (var1 == null) {
  389.          return null;
  390.       } else {
  391.          try {
  392.             return this.getName().substring(var1.getName().length());
  393.          } catch (IndexOutOfBoundsException var3) {
  394.             throw new InternalError("Malformed class name");
  395.          }
  396.       }
  397.    }
  398.  
  399.    private boolean isLocalOrAnonymousClass() {
  400.       return this.getEnclosingMethodInfo() != null;
  401.    }
  402.  
  403.    public Class<?>[] getClasses() {
  404.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  405.       Class[] var1 = (Class[])AccessController.doPrivileged(new 2(this));
  406.       return var1;
  407.    }
  408.  
  409.    public Field[] getFields() throws SecurityException {
  410.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  411.       return copyFields(this.privateGetPublicFields((Set)null));
  412.    }
  413.  
  414.    public Method[] getMethods() throws SecurityException {
  415.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  416.       return copyMethods(this.privateGetPublicMethods());
  417.    }
  418.  
  419.    public Constructor<?>[] getConstructors() throws SecurityException {
  420.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  421.       return copyConstructors(this.privateGetDeclaredConstructors(true));
  422.    }
  423.  
  424.    public Field getField(String var1) throws NoSuchFieldException, SecurityException {
  425.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  426.       Field var2 = this.getField0(var1);
  427.       if (var2 == null) {
  428.          throw new NoSuchFieldException(var1);
  429.       } else {
  430.          return var2;
  431.       }
  432.    }
  433.  
  434.    public Method getMethod(String var1, Class<?>... var2) throws NoSuchMethodException, SecurityException {
  435.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  436.       Method var3 = this.getMethod0(var1, var2);
  437.       if (var3 == null) {
  438.          throw new NoSuchMethodException(this.getName() + "." + var1 + argumentTypesToString(var2));
  439.       } else {
  440.          return var3;
  441.       }
  442.    }
  443.  
  444.    public Constructor<T> getConstructor(Class<?>... var1) throws NoSuchMethodException, SecurityException {
  445.       this.checkMemberAccess(0, ClassLoader.getCallerClassLoader());
  446.       return this.getConstructor0(var1, 0);
  447.    }
  448.  
  449.    public Class<?>[] getDeclaredClasses() throws SecurityException {
  450.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  451.       return this.getDeclaredClasses0();
  452.    }
  453.  
  454.    public Field[] getDeclaredFields() throws SecurityException {
  455.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  456.       return copyFields(this.privateGetDeclaredFields(false));
  457.    }
  458.  
  459.    public Method[] getDeclaredMethods() throws SecurityException {
  460.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  461.       return copyMethods(this.privateGetDeclaredMethods(false));
  462.    }
  463.  
  464.    public Constructor<?>[] getDeclaredConstructors() throws SecurityException {
  465.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  466.       return copyConstructors(this.privateGetDeclaredConstructors(false));
  467.    }
  468.  
  469.    public Field getDeclaredField(String var1) throws NoSuchFieldException, SecurityException {
  470.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  471.       Field var2 = this.searchFields(this.privateGetDeclaredFields(false), var1);
  472.       if (var2 == null) {
  473.          throw new NoSuchFieldException(var1);
  474.       } else {
  475.          return var2;
  476.       }
  477.    }
  478.  
  479.    public Method getDeclaredMethod(String var1, Class<?>... var2) throws NoSuchMethodException, SecurityException {
  480.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  481.       Method var3 = searchMethods(this.privateGetDeclaredMethods(false), var1, var2);
  482.       if (var3 == null) {
  483.          throw new NoSuchMethodException(this.getName() + "." + var1 + argumentTypesToString(var2));
  484.       } else {
  485.          return var3;
  486.       }
  487.    }
  488.  
  489.    public Constructor<T> getDeclaredConstructor(Class<?>... var1) throws NoSuchMethodException, SecurityException {
  490.       this.checkMemberAccess(1, ClassLoader.getCallerClassLoader());
  491.       return this.getConstructor0(var1, 1);
  492.    }
  493.  
  494.    public InputStream getResourceAsStream(String var1) {
  495.       var1 = this.resolveName(var1);
  496.       ClassLoader var2 = this.getClassLoader0();
  497.       return var2 == null ? ClassLoader.getSystemResourceAsStream(var1) : var2.getResourceAsStream(var1);
  498.    }
  499.  
  500.    public URL getResource(String var1) {
  501.       var1 = this.resolveName(var1);
  502.       ClassLoader var2 = this.getClassLoader0();
  503.       return var2 == null ? ClassLoader.getSystemResource(var1) : var2.getResource(var1);
  504.    }
  505.  
  506.    public ProtectionDomain getProtectionDomain() {
  507.       SecurityManager var1 = System.getSecurityManager();
  508.       if (var1 != null) {
  509.          var1.checkPermission(SecurityConstants.GET_PD_PERMISSION);
  510.       }
  511.  
  512.       ProtectionDomain var2 = this.getProtectionDomain0();
  513.       if (var2 == null) {
  514.          if (allPermDomain == null) {
  515.             Permissions var3 = new Permissions();
  516.             var3.add(SecurityConstants.ALL_PERMISSION);
  517.             allPermDomain = new ProtectionDomain((CodeSource)null, var3);
  518.          }
  519.  
  520.          var2 = allPermDomain;
  521.       }
  522.  
  523.       return var2;
  524.    }
  525.  
  526.    private native ProtectionDomain getProtectionDomain0();
  527.  
  528.    native void setProtectionDomain0(ProtectionDomain var1);
  529.  
  530.    static native Class getPrimitiveClass(String var0);
  531.  
  532.    private void checkMemberAccess(int var1, ClassLoader var2) {
  533.       SecurityManager var3 = System.getSecurityManager();
  534.       if (var3 != null) {
  535.          var3.checkMemberAccess(this, var1);
  536.          ClassLoader var4 = this.getClassLoader0();
  537.          if (var2 != null && var2 != var4 && (var4 == null || !var4.isAncestor(var2))) {
  538.             String var5 = this.getName();
  539.             int var6 = var5.lastIndexOf(46);
  540.             if (var6 != -1) {
  541.                var3.checkPackageAccess(var5.substring(0, var6));
  542.             }
  543.          }
  544.       }
  545.  
  546.    }
  547.  
  548.    private String resolveName(String var1) {
  549.       if (var1 == null) {
  550.          return var1;
  551.       } else {
  552.          if (!var1.startsWith("/")) {
  553.             Class var2;
  554.             for(var2 = this; var2.isArray(); var2 = var2.getComponentType()) {
  555.             }
  556.  
  557.             String var3 = var2.getName();
  558.             int var4 = var3.lastIndexOf(46);
  559.             if (var4 != -1) {
  560.                var1 = var3.substring(0, var4).replace('.', '/') + "/" + var1;
  561.             }
  562.          } else {
  563.             var1 = var1.substring(1);
  564.          }
  565.  
  566.          return var1;
  567.       }
  568.    }
  569.  
  570.    private void clearCachesOnClassRedefinition() {
  571.       if (this.lastRedefinedCount != this.classRedefinedCount) {
  572.          this.declaredFields = this.publicFields = this.declaredPublicFields = null;
  573.          this.declaredMethods = this.publicMethods = this.declaredPublicMethods = null;
  574.          this.declaredConstructors = this.publicConstructors = null;
  575.          this.annotations = this.declaredAnnotations = null;
  576.          this.lastRedefinedCount = this.classRedefinedCount;
  577.       }
  578.  
  579.    }
  580.  
  581.    private native String getGenericSignature();
  582.  
  583.    private GenericsFactory getFactory() {
  584.       return CoreReflectionFactory.make(this, ClassScope.make(this));
  585.    }
  586.  
  587.    private ClassRepository getGenericInfo() {
  588.       if (this.genericInfo == null) {
  589.          this.genericInfo = ClassRepository.make(this.getGenericSignature(), this.getFactory());
  590.       }
  591.  
  592.       return this.genericInfo;
  593.    }
  594.  
  595.    private native byte[] getRawAnnotations();
  596.  
  597.    native ConstantPool getConstantPool();
  598.  
  599.    private Field[] privateGetDeclaredFields(boolean var1) {
  600.       checkInitted();
  601.       Field[] var2 = null;
  602.       if (useCaches) {
  603.          this.clearCachesOnClassRedefinition();
  604.          if (var1) {
  605.             if (this.declaredPublicFields != null) {
  606.                var2 = (Field[])this.declaredPublicFields.get();
  607.             }
  608.          } else if (this.declaredFields != null) {
  609.             var2 = (Field[])this.declaredFields.get();
  610.          }
  611.  
  612.          if (var2 != null) {
  613.             return var2;
  614.          }
  615.       }
  616.  
  617.       var2 = Reflection.filterFields(this, this.getDeclaredFields0(var1));
  618.       if (useCaches) {
  619.          if (var1) {
  620.             this.declaredPublicFields = new SoftReference(var2);
  621.          } else {
  622.             this.declaredFields = new SoftReference(var2);
  623.          }
  624.       }
  625.  
  626.       return var2;
  627.    }
  628.  
  629.    private Field[] privateGetPublicFields(Set var1) {
  630.       checkInitted();
  631.       Field[] var2 = null;
  632.       if (useCaches) {
  633.          this.clearCachesOnClassRedefinition();
  634.          if (this.publicFields != null) {
  635.             var2 = (Field[])this.publicFields.get();
  636.          }
  637.  
  638.          if (var2 != null) {
  639.             return var2;
  640.          }
  641.       }
  642.  
  643.       ArrayList var3 = new ArrayList();
  644.       if (var1 == null) {
  645.          var1 = new HashSet();
  646.       }
  647.  
  648.       Field[] var4 = this.privateGetDeclaredFields(true);
  649.       addAll(var3, var4);
  650.       Class[] var5 = this.getInterfaces();
  651.  
  652.       for(int var6 = 0; var6 < var5.length; ++var6) {
  653.          Class var7 = var5[var6];
  654.          if (!((Set)var1).contains(var7)) {
  655.             ((Set)var1).add(var7);
  656.             addAll(var3, var7.privateGetPublicFields((Set)var1));
  657.          }
  658.       }
  659.  
  660.       if (!this.isInterface()) {
  661.          Class var9 = this.getSuperclass();
  662.          if (var9 != null) {
  663.             addAll(var3, var9.privateGetPublicFields((Set)var1));
  664.          }
  665.       }
  666.  
  667.       var2 = new Field[var3.size()];
  668.       var3.toArray(var2);
  669.       if (useCaches) {
  670.          this.publicFields = new SoftReference(var2);
  671.       }
  672.  
  673.       return var2;
  674.    }
  675.  
  676.    private static void addAll(Collection var0, Field[] var1) {
  677.       for(int var2 = 0; var2 < var1.length; ++var2) {
  678.          var0.add(var1[var2]);
  679.       }
  680.  
  681.    }
  682.  
  683.    private Constructor[] privateGetDeclaredConstructors(boolean var1) {
  684.       checkInitted();
  685.       Constructor[] var2 = null;
  686.       if (useCaches) {
  687.          this.clearCachesOnClassRedefinition();
  688.          if (var1) {
  689.             if (this.publicConstructors != null) {
  690.                var2 = (Constructor[])this.publicConstructors.get();
  691.             }
  692.          } else if (this.declaredConstructors != null) {
  693.             var2 = (Constructor[])this.declaredConstructors.get();
  694.          }
  695.  
  696.          if (var2 != null) {
  697.             return var2;
  698.          }
  699.       }
  700.  
  701.       if (this.isInterface()) {
  702.          var2 = new Constructor[0];
  703.       } else {
  704.          var2 = this.getDeclaredConstructors0(var1);
  705.       }
  706.  
  707.       if (useCaches) {
  708.          if (var1) {
  709.             this.publicConstructors = new SoftReference(var2);
  710.          } else {
  711.             this.declaredConstructors = new SoftReference(var2);
  712.          }
  713.       }
  714.  
  715.       return var2;
  716.    }
  717.  
  718.    private Method[] privateGetDeclaredMethods(boolean var1) {
  719.       checkInitted();
  720.       Method[] var2 = null;
  721.       if (useCaches) {
  722.          this.clearCachesOnClassRedefinition();
  723.          if (var1) {
  724.             if (this.declaredPublicMethods != null) {
  725.                var2 = (Method[])this.declaredPublicMethods.get();
  726.             }
  727.          } else if (this.declaredMethods != null) {
  728.             var2 = (Method[])this.declaredMethods.get();
  729.          }
  730.  
  731.          if (var2 != null) {
  732.             return var2;
  733.          }
  734.       }
  735.  
  736.       var2 = this.getDeclaredMethods0(var1);
  737.       if (useCaches) {
  738.          if (var1) {
  739.             this.declaredPublicMethods = new SoftReference(var2);
  740.          } else {
  741.             this.declaredMethods = new SoftReference(var2);
  742.          }
  743.       }
  744.  
  745.       return var2;
  746.    }
  747.  
  748.    private Method[] privateGetPublicMethods() {
  749.       checkInitted();
  750.       Method[] var1 = null;
  751.       if (useCaches) {
  752.          this.clearCachesOnClassRedefinition();
  753.          if (this.publicMethods != null) {
  754.             var1 = (Method[])this.publicMethods.get();
  755.          }
  756.  
  757.          if (var1 != null) {
  758.             return var1;
  759.          }
  760.       }
  761.  
  762.       MethodArray var2 = new MethodArray();
  763.       Method[] var3 = this.privateGetDeclaredMethods(true);
  764.       var2.addAll(var3);
  765.       MethodArray var10 = new MethodArray();
  766.       Class[] var4 = this.getInterfaces();
  767.  
  768.       for(int var5 = 0; var5 < var4.length; ++var5) {
  769.          var10.addAll(var4[var5].privateGetPublicMethods());
  770.       }
  771.  
  772.       if (!this.isInterface()) {
  773.          Class var11 = this.getSuperclass();
  774.          if (var11 != null) {
  775.             MethodArray var6 = new MethodArray();
  776.             var6.addAll(var11.privateGetPublicMethods());
  777.  
  778.             for(int var7 = 0; var7 < var6.length(); ++var7) {
  779.                Method var8 = var6.get(var7);
  780.                if (var8 != null && !Modifier.isAbstract(var8.getModifiers())) {
  781.                   var10.removeByNameAndSignature(var8);
  782.                }
  783.             }
  784.  
  785.             var6.addAll(var10);
  786.             var10 = var6;
  787.          }
  788.       }
  789.  
  790.       for(int var12 = 0; var12 < var2.length(); ++var12) {
  791.          Method var13 = var2.get(var12);
  792.          var10.removeByNameAndSignature(var13);
  793.       }
  794.  
  795.       var2.addAllIfNotPresent(var10);
  796.       var2.compactAndTrim();
  797.       var1 = var2.getArray();
  798.       if (useCaches) {
  799.          this.publicMethods = new SoftReference(var1);
  800.       }
  801.  
  802.       return var1;
  803.    }
  804.  
  805.    private Field searchFields(Field[] var1, String var2) {
  806.       String var3 = var2.intern();
  807.  
  808.       for(int var4 = 0; var4 < var1.length; ++var4) {
  809.          if (var1[var4].getName() == var3) {
  810.             return getReflectionFactory().copyField(var1[var4]);
  811.          }
  812.       }
  813.  
  814.       return null;
  815.    }
  816.  
  817.    private Field getField0(String var1) throws NoSuchFieldException {
  818.       Object var2 = null;
  819.       Field var6;
  820.       if ((var6 = this.searchFields(this.privateGetDeclaredFields(true), var1)) != null) {
  821.          return var6;
  822.       } else {
  823.          Class[] var3 = this.getInterfaces();
  824.  
  825.          for(int var4 = 0; var4 < var3.length; ++var4) {
  826.             Class var5 = var3[var4];
  827.             if ((var6 = var5.getField0(var1)) != null) {
  828.                return var6;
  829.             }
  830.          }
  831.  
  832.          if (!this.isInterface()) {
  833.             Class var9 = this.getSuperclass();
  834.             if (var9 != null && (var6 = var9.getField0(var1)) != null) {
  835.                return var6;
  836.             }
  837.          }
  838.  
  839.          return null;
  840.       }
  841.    }
  842.  
  843.    private static Method searchMethods(Method[] var0, String var1, Class[] var2) {
  844.       Method var3 = null;
  845.       String var4 = var1.intern();
  846.  
  847.       for(int var5 = 0; var5 < var0.length; ++var5) {
  848.          Method var6 = var0[var5];
  849.          if (var6.getName() == var4 && arrayContentsEq(var2, var6.getParameterTypes()) && (var3 == null || var3.getReturnType().isAssignableFrom(var6.getReturnType()))) {
  850.             var3 = var6;
  851.          }
  852.       }
  853.  
  854.       return var3 == null ? var3 : getReflectionFactory().copyMethod(var3);
  855.    }
  856.  
  857.    private Method getMethod0(String var1, Class[] var2) {
  858.       Object var3 = null;
  859.       Method var7;
  860.       if ((var7 = searchMethods(this.privateGetDeclaredMethods(true), var1, var2)) != null) {
  861.          return var7;
  862.       } else {
  863.          if (!this.isInterface()) {
  864.             Class var4 = this.getSuperclass();
  865.             if (var4 != null && (var7 = var4.getMethod0(var1, var2)) != null) {
  866.                return var7;
  867.             }
  868.          }
  869.  
  870.          Class[] var10 = this.getInterfaces();
  871.  
  872.          for(int var5 = 0; var5 < var10.length; ++var5) {
  873.             Class var6 = var10[var5];
  874.             if ((var7 = var6.getMethod0(var1, var2)) != null) {
  875.                return var7;
  876.             }
  877.          }
  878.  
  879.          return null;
  880.       }
  881.    }
  882.  
  883.    private Constructor<T> getConstructor0(Class[] var1, int var2) throws NoSuchMethodException {
  884.       Constructor[] var3 = this.privateGetDeclaredConstructors(var2 == 0);
  885.  
  886.       for(int var4 = 0; var4 < var3.length; ++var4) {
  887.          if (arrayContentsEq(var1, var3[var4].getParameterTypes())) {
  888.             return getReflectionFactory().copyConstructor(var3[var4]);
  889.          }
  890.       }
  891.  
  892.       throw new NoSuchMethodException(this.getName() + ".<init>" + argumentTypesToString(var1));
  893.    }
  894.  
  895.    private static boolean arrayContentsEq(Object[] var0, Object[] var1) {
  896.       if (var0 != null) {
  897.          if (var1 == null) {
  898.             return var0.length == 0;
  899.          } else if (var0.length != var1.length) {
  900.             return false;
  901.          } else {
  902.             for(int var2 = 0; var2 < var0.length; ++var2) {
  903.                if (var0[var2] != var1[var2]) {
  904.                   return false;
  905.                }
  906.             }
  907.  
  908.             return true;
  909.          }
  910.       } else {
  911.          return var1 == null || var1.length == 0;
  912.       }
  913.    }
  914.  
  915.    private static Field[] copyFields(Field[] var0) {
  916.       Field[] var1 = new Field[var0.length];
  917.       ReflectionFactory var2 = getReflectionFactory();
  918.  
  919.       for(int var3 = 0; var3 < var0.length; ++var3) {
  920.          var1[var3] = var2.copyField(var0[var3]);
  921.       }
  922.  
  923.       return var1;
  924.    }
  925.  
  926.    private static Method[] copyMethods(Method[] var0) {
  927.       Method[] var1 = new Method[var0.length];
  928.       ReflectionFactory var2 = getReflectionFactory();
  929.  
  930.       for(int var3 = 0; var3 < var0.length; ++var3) {
  931.          var1[var3] = var2.copyMethod(var0[var3]);
  932.       }
  933.  
  934.       return var1;
  935.    }
  936.  
  937.    private static Constructor[] copyConstructors(Constructor[] var0) {
  938.       Constructor[] var1 = new Constructor[var0.length];
  939.       ReflectionFactory var2 = getReflectionFactory();
  940.  
  941.       for(int var3 = 0; var3 < var0.length; ++var3) {
  942.          var1[var3] = var2.copyConstructor(var0[var3]);
  943.       }
  944.  
  945.       return var1;
  946.    }
  947.  
  948.    private native Field[] getDeclaredFields0(boolean var1);
  949.  
  950.    private native Method[] getDeclaredMethods0(boolean var1);
  951.  
  952.    private native Constructor[] getDeclaredConstructors0(boolean var1);
  953.  
  954.    private native Class[] getDeclaredClasses0();
  955.  
  956.    private static String argumentTypesToString(Class[] var0) {
  957.       StringBuilder var1 = new StringBuilder();
  958.       var1.append("(");
  959.       if (var0 != null) {
  960.          for(int var2 = 0; var2 < var0.length; ++var2) {
  961.             if (var2 > 0) {
  962.                var1.append(", ");
  963.             }
  964.  
  965.             Class var3 = var0[var2];
  966.             var1.append(var3 == null ? "null" : var3.getName());
  967.          }
  968.       }
  969.  
  970.       var1.append(")");
  971.       return var1.toString();
  972.    }
  973.  
  974.    public boolean desiredAssertionStatus() {
  975.       ClassLoader var1 = this.getClassLoader();
  976.       if (var1 == null) {
  977.          return desiredAssertionStatus0(this);
  978.       } else {
  979.          synchronized(var1) {
  980.             return var1.classAssertionStatus == null ? desiredAssertionStatus0(this) : var1.desiredAssertionStatus(this.getName());
  981.          }
  982.       }
  983.    }
  984.  
  985.    private static native boolean desiredAssertionStatus0(Class var0);
  986.  
  987.    public boolean isEnum() {
  988.       return (this.getModifiers() & 16384) != 0 && this.getSuperclass() == Enum.class;
  989.    }
  990.  
  991.    private static ReflectionFactory getReflectionFactory() {
  992.       if (reflectionFactory == null) {
  993.          reflectionFactory = (ReflectionFactory)AccessController.doPrivileged(new ReflectionFactory.GetReflectionFactoryAction());
  994.       }
  995.  
  996.       return reflectionFactory;
  997.    }
  998.  
  999.    private static void checkInitted() {
  1000.       if (!initted) {
  1001.          AccessController.doPrivileged(new 3());
  1002.       }
  1003.    }
  1004.  
  1005.    public T[] getEnumConstants() {
  1006.       Object[] var1 = this.getEnumConstantsShared();
  1007.       return (T[])(var1 != null ? (Object[])((Object;)var1).clone() : null);
  1008.    }
  1009.  
  1010.    T[] getEnumConstantsShared() {
  1011.       if (this.enumConstants == null) {
  1012.          if (!this.isEnum()) {
  1013.             return null;
  1014.          }
  1015.  
  1016.          try {
  1017.             Method var1 = this.getMethod("values");
  1018.             AccessController.doPrivileged(new 4(this, var1));
  1019.             this.enumConstants = (T[])((Object[])var1.invoke((Object)null));
  1020.          } catch (InvocationTargetException var2) {
  1021.             return null;
  1022.          } catch (NoSuchMethodException var3) {
  1023.             return null;
  1024.          } catch (IllegalAccessException var4) {
  1025.             return null;
  1026.          }
  1027.       }
  1028.  
  1029.       return this.enumConstants;
  1030.    }
  1031.  
  1032.    Map<String, T> enumConstantDirectory() {
  1033.       if (this.enumConstantDirectory == null) {
  1034.          Object[] var1 = this.getEnumConstantsShared();
  1035.          if (var1 == null) {
  1036.             throw new IllegalArgumentException(this.getName() + " is not an enum type");
  1037.          }
  1038.  
  1039.          HashMap var2 = new HashMap(2 * var1.length);
  1040.  
  1041.          for(Object var6 : var1) {
  1042.             var2.put(((Enum)var6).name(), var6);
  1043.          }
  1044.  
  1045.          this.enumConstantDirectory = var2;
  1046.       }
  1047.  
  1048.       return this.enumConstantDirectory;
  1049.    }
  1050.  
  1051.    public T cast(Object var1) {
  1052.       if (var1 != null && !this.isInstance(var1)) {
  1053.          throw new ClassCastException();
  1054.       } else {
  1055.          return (T)var1;
  1056.       }
  1057.    }
  1058.  
  1059.    public <U> Class<? extends U> asSubclass(Class<U> var1) {
  1060.       if (var1.isAssignableFrom(this)) {
  1061.          return this;
  1062.       } else {
  1063.          throw new ClassCastException(this.toString());
  1064.       }
  1065.    }
  1066.  
  1067.    public <A extends Annotation> A getAnnotation(Class<A> var1) {
  1068.       if (var1 == null) {
  1069.          throw new NullPointerException();
  1070.       } else {
  1071.          this.initAnnotationsIfNecessary();
  1072.          return (A)(this.annotations.get(var1));
  1073.       }
  1074.    }
  1075.  
  1076.    public boolean isAnnotationPresent(Class<? extends Annotation> var1) {
  1077.       if (var1 == null) {
  1078.          throw new NullPointerException();
  1079.       } else {
  1080.          return this.getAnnotation(var1) != null;
  1081.       }
  1082.    }
  1083.  
  1084.    public Annotation[] getAnnotations() {
  1085.       this.initAnnotationsIfNecessary();
  1086.       return (Annotation[])this.annotations.values().toArray(EMPTY_ANNOTATIONS_ARRAY);
  1087.    }
  1088.  
  1089.    public Annotation[] getDeclaredAnnotations() {
  1090.       this.initAnnotationsIfNecessary();
  1091.       return (Annotation[])this.declaredAnnotations.values().toArray(EMPTY_ANNOTATIONS_ARRAY);
  1092.    }
  1093.  
  1094.    private synchronized void initAnnotationsIfNecessary() {
  1095.       this.clearCachesOnClassRedefinition();
  1096.       if (this.annotations == null) {
  1097.          this.declaredAnnotations = AnnotationParser.parseAnnotations(this.getRawAnnotations(), this.getConstantPool(), this);
  1098.          Class var1 = this.getSuperclass();
  1099.          if (var1 == null) {
  1100.             this.annotations = this.declaredAnnotations;
  1101.          } else {
  1102.             this.annotations = new HashMap();
  1103.             var1.initAnnotationsIfNecessary();
  1104.  
  1105.             for(Map.Entry var3 : var1.annotations.entrySet()) {
  1106.                Class var4 = (Class)var3.getKey();
  1107.                if (AnnotationType.getInstance(var4).isInherited()) {
  1108.                   this.annotations.put(var4, var3.getValue());
  1109.                }
  1110.             }
  1111.  
  1112.             this.annotations.putAll(this.declaredAnnotations);
  1113.          }
  1114.  
  1115.       }
  1116.    }
  1117.  
  1118.    void setAnnotationType(AnnotationType var1) {
  1119.       this.annotationType = var1;
  1120.    }
  1121.  
  1122.    AnnotationType getAnnotationType() {
  1123.       return this.annotationType;
  1124.    }
  1125.  
  1126.    // $FF: synthetic method
  1127.    static boolean access$100(Object[] var0, Object[] var1) {
  1128.       return arrayContentsEq(var0, var1);
  1129.    }
  1130.  
  1131.    // $FF: synthetic method
  1132.    static boolean access$202(boolean var0) {
  1133.       useCaches = var0;
  1134.       return var0;
  1135.    }
  1136.  
  1137.    // $FF: synthetic method
  1138.    static boolean access$302(boolean var0) {
  1139.       initted = var0;
  1140.       return var0;
  1141.    }
  1142.  
  1143.    static {
  1144.       registerNatives();
  1145.       useCaches = true;
  1146.       serialPersistentFields = new ObjectStreamField[0];
  1147.       initted = false;
  1148.       EMPTY_ANNOTATIONS_ARRAY = new Annotation[0];
  1149.    }
  1150. }
  1151.